import SwiftUI

struct StoreCardView: View {
    
    var storeDetail: FoodStoreItemModel
    
    var body: some View {
        HStack(spacing: 8.0) {
            VStack(alignment: .leading, spacing: 32.0) {
                VStack(alignment: .leading, spacing: 11.0) {
                    HStack(spacing: 16.0) {
                        keyItem(key: "中文名")
                        valueItem(value: storeDetail.cnName)
                    }
                    
                    HStack(spacing: 16.0) {
                        keyItem(key: "印尼名")
                        valueItem(value: storeDetail.title)
                    }
                    HStack(spacing: 16.0) {
                        keyItem(key: "入驻时间")
                        valueItem(value: storeDetail.entryTime)
                    }
                }
                
                VStack(alignment: .leading, spacing: 16.0) {
                    HStack(alignment: .top, spacing: 16.0) {
                        keyItem(key: "中文地址")
                        valueItem(value: storeDetail.cnAddress)
                    }
                    HStack(alignment: .top, spacing: 16.0) {
                        keyItem(key: "印尼语地址")
                        valueItem(value: storeDetail.address)
                    }
                }
                
                HStack(alignment: .top, spacing: 16.0) {
                    keyItem(key: "联系人")
                    valueItem(value: storeDetail.contacter)
                }
            }
            Spacer()
        }
        .padding(.vertical, 16.0)
        .padding(.horizontal, 12.0)
        .background(
            RoundedRectangle(cornerRadius: 12.0)
                .fill(Color.fsFFFFFF)
        )
    }
    
    private func keyItem(key: String) -> some View {
        Text(key)
            .font(.alibabaPuHuiTi(size: 14.0, weight: .regular))
            .foregroundStyle(Color.fs9C9C9C)
            .frame(width: 70, alignment: .trailing)
    }
    
    private func valueItem(value: String) -> some View {
        Text(value)
            .font(.alibabaPuHuiTi(size: 14.0, weight: .regular))
            .foregroundStyle(Color.fs020000)
    }
}
